<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">
        <ui:define name="title">
            <h:outputText value="List all Price Lists"></h:outputText>
        </ui:define>
        <ui:define name="content">
            <h:form prependId="false">
                <p:panel header="List all Price Lists">
                    <p:messages />
                    <br />
                    <h:outputText escape="false" value="(No Price List Items Found)" rendered="#{priceListEntityController.items.rowCount == 0}"/>
                    <h:panelGroup rendered="#{priceListEntityController.items.rowCount > 0}">
                        <p:dataTable value="#{priceListEntityController.items}" 
                                     var="item" style="table-layout:fixed"
                                     paginator="true" rows="10"  
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                     rowsPerPageTemplate="5,10,15">
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Customer Type"/>
                                </f:facet>
                                <h:outputText value="#{item.type}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Product"/>
                                </f:facet>
                                <h:outputText value="#{item.product.productName}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Tiered Quantity"/>
                                </f:facet>
                                <h:outputText value="#{item.tieredQuantity}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Price (Per Unit)"/>
                                </f:facet>
                                <h:outputText value="#{item.price}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <p:commandButton image="ui-icon ui-icon-search" action="#{priceListEntityController.prepareView}" ajax="false"/>
                            </p:column>
                            <p:column>
                                <p:menuButton value="Options"> 
                                <p:menuitem ajax="false" icon="ui-icon ui-icon-disk" action="#{priceListEntityController.prepareEdit}" value="Edit"/>
                                <p:menuitem ajax="false" icon="ui-icon ui-icon-trash" action="#{priceListEntityController.destroy}" value="Delete"/>
                            </p:menuButton>
                            </p:column>
                        </p:dataTable>
                    </h:panelGroup>
                    <br />
                    <p:commandButton ajax="false" action="#{priceListEntityController.prepareCreate}" value="Add New Price"/>
                    <br />
                    <br />
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
